package com.kk.score.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kk.score.entity.DepartmentEntity;
import com.kk.score.entity.PositionEntity;
import com.kk.score.entity.UserEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 
 * 
 * @author KK
 * @email 409592048@qq.com
 * @date 2022-11-02 12:28:00
 */
@Mapper
public interface UserDao extends BaseMapper<UserEntity> {

    /**
     * 查询用户分页
     * @param page
     * @param departmentUid
     * @param positionUid
     * @param status
     * @return
     */
    IPage<?> findUserPage(Page<UserEntity> page, String departmentUid, String positionUid, String status);

    /**
     * 批量删除部门下的用户
     * @param uids
     * @return
     */
    boolean deleteByDepartmentUids(String[] uids,Integer status);

    /**
     * 通过用户的uids获取部门
     * @param uids
     * @return
     */
    List<DepartmentEntity> selectDepartmentsByUserUids(String[] uids);

    /**
     * 批量删除职位下的用户
     * @param uids
     * @return
     */
    boolean deleteByPositionUids(String[] uids, Integer status);

    /**
     * 通过用户的uids获取职位
     * @param uids
     * @return
     */
    List<PositionEntity> selectPositionsByUserUids(String[] uids);

    int resetAllPassword(String encode);
}
